﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WarOfDev.EF;
using System.Web;
using System.Web.Mvc;

namespace WarOfDev.Core.StateManagentHelpers
{
    public class SessionHelper<TUser> where TUser : class
    {
        private const string currentUser = "_currentUser";

        public static TUser GetCurrentUser(HttpContextBase context)
        {
            return context.Session[currentUser] as TUser;
        }

        public static void SetCurrentUser(HttpContextBase context, TUser user)
        {
            context.Session[currentUser] = user;
        }

        public static void ClearSession(HttpContextBase context)
        {
            context.Session.Clear();
        }
    }
}



